<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--jstl을 쓰기 위해 사용 --%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><%--숫자 포맷을 사용하기 위해 사용 --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"  prefix="fn"%><%--함수들을 이용하기 위해 사용 --%>
<%@ taglib prefix="c-rt" uri="http://java.sun.com/jstl/core_rt" %>  <%-- ie버전 확인에 쓰기 위해 씀 --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="script/sms_riskI_script.js"></script>
<script type="text/javascript" src="script/sms_util_script.js"></script>
<link href="reset.css" rel="stylesheet" type="text/css" />
<link href="style.css" rel="stylesheet" type="text/css" />
<!--말 줄임 css(모든 브라우저 적용)-->
<style type="text/css">
.ellipsis{
	white-space:nowrap;
	text-overflow:ellipsis;		/* IE, Safari */
	-o-text-overflow:ellipsis;		/* Opera under 10.7 */
	overflow:hidden;			/* "overflow" value must be different from "visible" */ 
	-moz-binding: url('ellipsis.xml#ellipsis');
}
</style>


<script type="text/javascript">
function winClose(){
	window.close();
}

var xhr; // 비동기 서버 연동을 위한 객체
function createXMLHttpRequest(){
	if(window.ActiveXObject){//ms exploer 일 경우
		xhr=new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		xhr=new XMLHttpRequest();	
	}
}
function choiceData(pro_id, ak_id){
	//alert(pro_id);
	//var flag=confirm("선택하시겠습니까?");
	//if(flag){
		opener.document.getElementById("racont_nm").value="";
		createXMLHttpRequest();
		xhr.onreadystatechange = choiceDataResult;
		xhr.open("POST","riskIAction.do",true);
		xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
		xhr.send("mode=tracontChoiceDataAjax&pro_id="+pro_id+"&ak_id="+ak_id);
	//}else {
	//	return false;
	//}
}
function choiceDataResult(){
	if(xhr.readyState==4){
		if(xhr.status==200){
			var result=xhr.responseText;
			var jsonData=eval('('+result+')');
			 //opener.document.getElementById("ak_id").value=jsonData.ak_id;
			 opener.document.getElementById("base_lev1").value=jsonData.base_lev1;
			 opener.document.getElementById("ak_nm2").value=jsonData.ak_nm2;
			 //opener.document.getElementById("racont_id").value=jsonData.racont_id;
			 winClose();
		}
	}
}
</script>
</head>
<body>
<c:if test="${sessionScope.USER_ID==null}">
		<script type="text/javascript">
			alert("연결이 끊어졌습니다. 다시 로그인 해주시기 바랍니다");
			window.close();
		</script>	
</c:if>
<div class="box">
      		<h4 class="white">
      			<span class="align-left">자산유형 생성</span>
	      		<span class="align-right">상태 :
		      		<c:choose>
		      			<c:when test="${sessionScope.magamSession[1].state =='Y'}">
		      				 마감
		      			</c:when>
		      			<c:otherwise>
		      				 착수
		      			</c:otherwise>
		      		</c:choose>
	      		</span>
      		</h4>
        <div class="box-container1">     		
        	<table class="table-long" style="margin: 0 auto;">
      			<tfoot>
      				<tr>
      					<td>
							<div class="align-left subjectTitle"> ■ 자산유형선택</div>					
	      					<div class="align-right">
		                     	 <a href="#" class="button" onclick="javascript: winClose()"><span>닫기</span></a>
	                     	</div>
      					</td>
      				</tr>
      				<tr><td class="spaceLine"></td></tr>
      			</tfoot>
      		</table>
      		<table class="table-long" style="margin: 0 auto;">
      			<colgroup>
					<col width="55px"/>
					<col width="110px"/>
					<col width="110px"/>
					<col/>
					<col width="15px"/>
				</colgroup>
      			<thead>
      				<tr>
      					<td class="col-chk col-rowspanMid"<c-rt:if test="${isMSIE67}">style="padding-left: 10px"</c-rt:if>></td>
      					<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      						자산유형
      					</td>
      					<td>분류기준</td>
      					<td></td>
      				</tr>
      			</thead>
      		</table>
      		<div class="scrollDIV" style="height: 250px;">
      		<table class="table-long" style="margin: 0 auto;">
      			<colgroup>
					<col width="55px"/>
					<col width="110px"/>
					<col width="110px"/>
					<col/>
					<col width="15px"/>
				</colgroup>
      			<tbody>
      				<c:choose>
                    	<c:when test="${fn:length(list)!= 0}">
                       	<c:forEach var="list" items="${requestScope.list}" varStatus="status">
	                    			<%--
	                    			<tr onmouseover="ChangeBackground(this,'over','${status.index}');" onmouseout="ChangeBackground(this,'out','${status.index}');" class="odd">
	                    			 --%>
	                    	 <tr <c:if test="${status.index%2==0 }">class="odd"</c:if> onmouseover="ChangeBackground(this,'over','${status.index}');" onmouseout="ChangeBackground(this,'out','${status.index}');">
                    			<td class="col-chk col-rowspanMid col-alignCenter">
                    			<input type="radio" name="choice" id="choice" onclick="choiceData('${sessionScope.lastProId }','${list.ak_id }')"></input>
                    			</td>
                    			
                    			<c:if test="${list.ak_nm1 != list.ak_nm2 }">
                    			<td>
                    				<div class="ellipsis"  style="width:100%;" title="${list.ak_nm1 }">${list.ak_nm1 }</div>
                    			</td>
                    			</c:if>
                    			<td <c:if test="${list.ak_nm1 == list.ak_nm2 }">colspan="2" style="padding-left: 65px"</c:if>>
                    				<div class="ellipsis"  style="width:100%;">
                    				<div class="ellipsis"  style="width:100%;" title="${list.ak_nm2 }">${list.ak_nm2 }</div>
                    				</div>
                    			</td>
                    			
                    			<td>
                    				<div class="ellipsis"  style="width:100%;" title="${list.ak_standard }">${list.ak_standard }</div>
                    			</td>
	   					 	<td></td>
                    		</tr>
	                    		
                    	</c:forEach>
                    	</c:when>
                    	<c:otherwise>
                    		<tr class="odd">
								<td colspan="5"  class="noDataTD">-데이터가 없습니다-</td>
							</tr>
                    	</c:otherwise>
                    	</c:choose>
      			</tbody>
      		</table>
      		</div>
      	</div><!-- end of div.box-container1 -->
      	</div> <!-- end of div.box -->
</body>
</html>